export class LevelMgr {
    private static _instance: LevelMgr | null = null;

    private _curLevel: number = 1;

    public static getInstance(): LevelMgr {
        if (!LevelMgr._instance) {
            LevelMgr._instance = new LevelMgr();
        }
        return LevelMgr._instance;
    }

    get curLevel(): number {
        return this._curLevel;
    }

    set curLevel(value: number) {
        this._curLevel = value;
    }


    private constructor() {
        
    }


    getPoolFileName(level:number = this._curLevel): string {
        const paddedLevel = ('00000' + level).slice(-5);
        return `1${paddedLevel}_pool`;
    }

    getOrdersFileName(level:number = this._curLevel): string {
        const paddedLevel = ('00000' + level).slice(-5);
        return `1${paddedLevel}_orders`;
    }

    getMapFileName(level:number = this._curLevel): string {
        const paddedLevel = ('00000' + level).slice(-5);
        return `1${paddedLevel}`;
    }

    next() {
        return ++this._curLevel; 
    }
}